<%doc>
USAGE DOCUMENTATION :: PLEASE LEAVE THIS AT THE TOP OF THIS FILE

For Mako templating syntax documentation please visit: http://docs.makotemplates.org/en/latest/

Filename:           library_stats.html
Version:            0.1
Variable names:     data [array]

data[array_index] :: Usable parameters

data            Returns an array containing stat data

data[array_index] :: Usable parameters

section_name            Returns the title of the library.
section_type            Returns the type of the library.
thumb                   Returns the thumb of the library.
count                   Returns the number of top level items in the library.
parent_count            Returns the number of parent items in the library.
child_count             Returns the number of child items in the library.

DOCUMENTATION :: END
</%doc>

% if data:
<%
    from plexpy.helpers import page

    types = ('movie', 'show', 'artist', 'photo')
    headers = {'movie': ('Movie Libraries', ('Movies', '', '')),
               'show': ('TV Show Libraries', ('Shows', 'Seasons', 'Episodes')),
               'artist': ('Music Libraries', ('Artists', 'Albums', 'Tracks')),
               'photo': ('Photo Libraries', ('Albums', 'Photos', 'Videos'))}
%>
% for section_type in types:
% if section_type in data:
<%
    row0 = data[section_type][0]
%>
<div class="dashboard-stats-instance" id="library-stats-instance-${section_type}" data-section_type="${section_type}">
    <div class="dashboard-stats-container">
        <div id="library-stats-background-${section_type}" class="dashboard-stats-background" style="background-image: url(${page('pms_image_proxy', row0['art'] or row0['library_art'], None, 500, 280, 40, '282828', 3, fallback=row0['library_art'])});" data-library_art="${row0['library_art']}">
            % if row0['thumb'].startswith('http'):
            <div id="library-stats-thumb-${section_type}" class="dashboard-stats-flat hidden-xs" style="background-image: url(${page('pms_image_proxy', row0['thumb'], None, 80, 80)});"></div>
            % else:
            <div id="library-stats-thumb-${section_type}" class="dashboard-stats-flat svg-icon library-${section_type} hidden-xs"></div>
            % endif
            <div class="dashboard-stats-info-container">
                <div id="library-stats-title-${section_type}" class="dashboard-stats-info-title">
                    <h4>${headers[section_type][0]}</h4>
                    <span class="dashboard-stats-stats-units">${' / '.join(u for u in headers[section_type][1] if u)}</span>
                </div>
                <div class="dashboard-stats-info-scroller scrollbar-macosx">
                    <div class="dashboard-stats-info scoller-content">
                        <ul class="list-unstyled dashboard-stats-info-list">
                            % for section in data[section_type]:
                            <li class="dashboard-stats-info-item ${'expanded' if loop.index == 0 else ''}" data-stat_id="${section_type}"
                                data-art="${section.get('art')}" data-thumb="${section.get('thumb')}" data-library_art="${section.get('library_art')}">
                                <div class="sub-list">${loop.index + 1}</div>
                                <div class="sub-value">
                                    <a href="${page('library', section['section_id'])}" title="${section['section_name']}">
                                        ${section['section_name']}
                                    </a>
                                </div>
                                % if headers[section_type][1][0]:
                                <div class="sub-count">
                                    ${section['count']}
                                </div>
                                % endif
                                % if headers[section_type][1][1]:
                                <div class="sub-divider"> / </div>
                                <div class="sub-count">
                                    ${section['child_count']}
                                </div>
                                % endif
                                % if headers[section_type][1][2]:
                                <div class="sub-divider"> / </div>
                                <div class="sub-count">
                                    ${section['grandchild_count']}
                                </div>
                                % endif
                            </li>
                            % endfor
                        </ul>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
% endif
% endfor
% else:
<div class="text-muted">No stats to show.</div><br>
% endif